package com.service.userimpl;

import com.dao.UserMapper;
import com.model.User;
import com.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 编写者：王懿宸
 * 编写时间：2019-5-29
 * 类模块描述：查询及相关增删改
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User selectByPrimaryKey(int uid) {
        System.out.println("输入的参数为："+uid);
        return userMapper.selectByPrimaryKey(uid);
    }

    @Override
    public List<User> getAll1() {
        return userMapper.getAll1();
    }

    @Override
    public List<User> getUIsBegin() {
        return userMapper.getUIsBegin();
    }

    //删除角色信息
    @Override
    public int delUser(Integer uid) {
        return userMapper.delUser(uid);
    }
    //新增角色信息
    @Override
    public int insertUser(User usermodel) {
        return userMapper.insertUser(usermodel);
    }
    //执行业务判断
    @Override
    public String getUser(User usermodel) {
        String tempStr="no";
     List<User> userList=userMapper.getUser(usermodel);
     if (!userList.isEmpty()){
         System.out.println(userList.size());
         if (userList.size()>0){
             tempStr="ok";
         }

     }
        return tempStr;
    }
}
